package common;

public class PrimeNumbers {

    public int countPrimes(int n) {

        if(n<2){
            return 0;
        }
        if(n==2){
            return 1;
        }

        int count = n/2+1;

        for (int i = 3; i <=n; i=i+2) {
            for(int j=2;j<i;j++){
                if(i%j==0){
                    count--;
                    break;
                }
            }
        }


        return count;
    }
}
